<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
  <xsl:variable name ="Application">
    <xsl:value-of select ="/OperType/@Application"/>
  </xsl:variable>
  <xsl:variable name ="IsDisabled">
    <xsl:value-of select ="/OperType/@IsDisabled"/>
  </xsl:variable> 
  <xsl:template match ="/">
    <table style="table-layout :fixed ;WIDTH: 100%;height:100%" border="0" cellpadding ="0" cellspacing ="0">
      <tr>
        <td valign="top">
          <table style="table-layout :fixed ;WIDTH: 100%" border="0" cellpadding ="0" cellspacing ="3">
          <xsl:for-each select ="OperType/GN">
            <tr>
              <td height="1px"></td>
            </tr>
            <xsl:choose >
              <xsl:when test ="@GroupName = ''">
              </xsl:when>
              <xsl:otherwise >
                <tr height="20px">
                  <td class="sec bar" valign="top">
                    <font style="font-size:12;color='#000000';font-family:宋体;" >
                      <xsl:value-of select ="@GroupName"/>
                    </font>
                  </td>
                </tr>
              </xsl:otherwise>
            </xsl:choose>
              <tr>
                <td valign="top">
                  <xsl:for-each select ="PZ">
                    <table style="table-layout :fixed ;WIDTH: 100%;"  border="0" cellpadding ="0" cellspacing ="0">
                      <colgroup >
                        <col width="15px"></col>
                        <col ></col>
                        <col width="15px"></col>
                      </colgroup>
                      <tr height="3px">
                        <td colspan="3"></td>
                      </tr>
                      <tr >
                        <td></td>
                        <xsl:choose >
                          <xsl:when test ="@PzName = ''">
                             <td height="0px"></td>
                          </xsl:when>
                          <xsl:otherwise >
                            <td  class="sec bar" height="20px">
                              <font style="font-size:12;color='#000000';font-family:宋体;" >
                                <xsl:value-of select ="@PzName"/>
                              </font>
                            </td>
                          </xsl:otherwise>
                        </xsl:choose>
                        <td></td>
                      </tr>
                      <tr>
                        <td></td>
                        <td>
                          <table style="table-layout :fixed ;WIDTH: 100%;"  border="0" cellpadding ="0" cellspacing ="0">
                            <col width="45px"></col>
                            <col width="5px"></col>
                            <col width="60px"></col>
                            <col ></col>
                            <col width="50px"></col>
                            <col width="1px"></col>
                            <tr height="5px">
                              <td colspan="6"></td>
                            </tr>
                            <tr heigth="25">
                              <xsl:attribute name ="GroupName">
                                <xsl:value-of select ="@GroupName"/>
                              </xsl:attribute>
                              <xsl:attribute name ="PzName">
                                <xsl:value-of select ="@PzName"/>
                              </xsl:attribute>
                              <xsl:attribute name ="PzOrderCode">
                                <xsl:value-of select ="@PzOrderCode"/>
                              </xsl:attribute>
                              <xsl:attribute name ="KmSqlFilterRule">
                                <xsl:value-of select ="@KmSqlFilterRule"/>
                              </xsl:attribute>
                              <xsl:attribute name ="IsAddEntry">
                                <xsl:value-of select ="@IsAddEntry"/>
                              </xsl:attribute>
                              <xsl:attribute name ="id">tr_<xsl:value-of select ="@PzOrderCode"/>
                              </xsl:attribute>
                              <td class="req">凭证字</td>
                              <td></td>
                              <td>
                                <input type="text" maxlength="10" name="txtPzz" forbiddenchars="@%#?|,-;'&quot;&amp;&lt;&gt;" >
                                  <xsl:attribute name ="id">txtPzz<xsl:value-of select ="@PzOrderCode"/></xsl:attribute>
                                  <xsl:attribute name ="value">
                                    <xsl:value-of select ="@Pzz"/>
                                  </xsl:attribute>
                                  <xsl:attribute name ="oldValue">
                                    <xsl:value-of select ="@Pzz"/>
                                  </xsl:attribute>
                                  <xsl:attribute name ="onchange">
                                    changePzz('<xsl:value-of select ="@PzOrderCode"/>')
                                  </xsl:attribute>
                                  <xsl:choose>
                                    <xsl:when test ="$IsDisabled='True'">
                                      <xsl:attribute name="style">background-color:transparent;border-color:#cccccc;</xsl:attribute>
                                      <xsl:attribute name="readonly">true</xsl:attribute>
                                    </xsl:when>
                                  </xsl:choose>
                                </input>
                              </td>
                              <td></td>
                              <xsl:choose >
                                <xsl:when test ="@IsAddEntry = '1' and $IsDisabled='False'">
                                   <td><font style="font-size:12;color='#0000FF';font-family:宋体;text-decoration :underline ;cursor:hand">
                                     <xsl:attribute name ="onclick">AddEntry('<xsl:value-of select ="@PzOrderCode"/>')</xsl:attribute>
                                     增加分录</font></td>
                                </xsl:when>
                                <xsl:otherwise >
                                   <td></td>
                                </xsl:otherwise>
                              </xsl:choose>
                              <td></td>
                            </tr>
                            <tr height="5px">
                              <td colspan="6"></td>
                            </tr>
                          </table>
                        </td>
                        <td></td>
                      </tr>
                      <tr >
                        <td></td>
                        <td>
                          <table style="table-layout :fixed ;WIDTH: 100%;BORDER-right:#7B9EBD 1px solid;BORDER-bottom:#7B9EBD 1px solid;" cellpadding ="0" cellspacing ="0" name="tabPz">
                            <xsl:attribute name ="id">tabPz<xsl:value-of select ="@PzOrderCode"/>
                            </xsl:attribute>
                            <col width="30px"></col>
                            <col></col>
                            <col width="120px"></col>
                            <col width="120px"></col>
                            <col width="100px"></col>
                            <col width="100px"></col>
                            <xsl:choose>
                              <xsl:when test ="$Application = '0101'">
                                <col width="60px"></col>
                              </xsl:when>
                              <xsl:otherwise></xsl:otherwise>
                            </xsl:choose>                         
                            <col width="20px">
                              <xsl:attribute name ="style">
                                <xsl:choose>
                                  <xsl:when test ="@IsAddEntry='1' and $IsDisabled='False'">display:inline</xsl:when>
                                  <xsl:otherwise>display:none</xsl:otherwise>
                                </xsl:choose>
                              </xsl:attribute>
                            </col>
                            <tr style="background-color:#E9E7D7 ;height:24px;text-align:center">
                              <td style="background-color:#E9E7D7 ;BORDER-left:#7B9EBD 1px solid;BORDER-top:#7B9EBD 1px solid;">
                                <nobr></nobr>
                              </td>
                              <td class="tdClass">摘要</td>
                              <td class="tdClass">会计科目</td>
                              <td class="tdClass">辅助核算</td>
                              <td class="tdClass">借方金额</td>
                              <td class="tdClass">贷方金额</td>                           
                              <td class="tdClass">
                                <xsl:attribute name ="style">
                                  <xsl:choose>
                                    <xsl:when test ="$Application = '0101'">display:inline</xsl:when>
                                    <xsl:otherwise>display:none</xsl:otherwise>
                                  </xsl:choose>
                                </xsl:attribute>
                                金额规则</td>
                              <td class="tdClass">
                                <xsl:attribute name ="style">
                                  <xsl:choose>
                                    <xsl:when test ="@IsAddEntry='1' and $IsDisabled='False'">display:inline</xsl:when>
                                    <xsl:otherwise>display:none</xsl:otherwise>
                                  </xsl:choose>
                                </xsl:attribute>
                                <nobr></nobr>
                              </td>
                            </tr>
                            <xsl:for-each select ="PzEntry">
                              <tr height="22px">
                                <xsl:attribute name ="GroupName">
                                  <xsl:value-of select ="@GroupName"/>
                                </xsl:attribute>
                                <xsl:attribute name ="PzName">
                                  <xsl:value-of select ="@PzName"/>
                                </xsl:attribute>
                                <xsl:attribute name ="PzOrderCode">
                                  <xsl:value-of select ="@PzOrderCode"/>
                                </xsl:attribute>
                                <xsl:attribute name ="KmSqlFilterRule">
                                  <xsl:value-of select ="@KmSqlFilterRule"/>
                                </xsl:attribute>
                                <xsl:attribute name ="PzEntryRuleGUID">
                                  <xsl:value-of select ="@PzEntryRuleGUID"/>
                                </xsl:attribute>
                                <xsl:attribute name ="Zy">
                                  <xsl:value-of select ="@Zy"/>
                                </xsl:attribute>
                                <xsl:attribute name ="ZySql">
                                  <xsl:value-of select ="@ZySql"/>
                                </xsl:attribute>
                                <xsl:attribute name ="ZyText">
                                  <xsl:value-of select ="@ZyText"/>
                                </xsl:attribute>
                                <xsl:attribute name ="KjkmGUID">
                                  <xsl:value-of select ="@KjkmGUID"/>
                                </xsl:attribute>
                                <xsl:attribute name ="KjkmFullName">
                                  <xsl:value-of select ="@KjkmName"/>
                                </xsl:attribute>
                                <xsl:attribute name ="YDDirection">
                                  <xsl:value-of select ="@YDDirection"/>
                                </xsl:attribute>
                                <xsl:attribute name ="AmountFiled">
                                  <xsl:value-of select ="@AmountFiled"/>
                                </xsl:attribute>
                                <xsl:attribute name ="AmountFiledCN">
                                  <xsl:value-of select ="@AmountFiledCN"/>
                                </xsl:attribute>
                                <xsl:attribute name ="IsInversion">
                                  <xsl:value-of select ="@IsInversion"/>
                                </xsl:attribute>
                                <xsl:attribute name ="EditStatus">
                                  <xsl:value-of select ="@EditStatus"/>
                                </xsl:attribute>
                                
                                <!--分录号-->
                                <td class="tdClass" style="text-align:center" >
                                  <nobr><xsl:value-of select ="@EntryNum"/></nobr>
                                </td>
                                <!--摘要-->
                                <td class="tdClass">
                                  <table cellpadding="0" cellspacing="0" width="100%" style="TABLE-LAYOUT:fixed" >
                                    <col></col>
                                    <col width="25" align="right"></col>
                                    <tr>
                                      <td>
                                        <input type="text" readonly="true" style="background-color:transparent;border-color:#cccccc">
                                          <xsl:attribute name ="value">
                                            <xsl:value-of select ="@ZyText"/>
                                          </xsl:attribute>
                                        </input>
                                      </td>
                                      <td align="right">
                                        <img style="cursor:hand" src="/_imgs/btn_off_lookup.gif" onclick="SelectZy(this)" >
                                          <xsl:choose>
                                            <xsl:when test ="$IsDisabled='True'">
                                              <xsl:attribute name="style">filter:gray;</xsl:attribute>
                                              <xsl:attribute name="disabled">true</xsl:attribute>
                                            </xsl:when>
                                          </xsl:choose>
                                        </img>
                                      </td>
                                    </tr>
                                  </table>
                                </td>
                                <!--会计科目-->
                                <td class="tdClass">
                                  <table cellpadding="0" cellspacing="0" width="100%" style="TABLE-LAYOUT:fixed">
                                      <col></col>
                                      <col width="25" align="right"></col>
                                        <tr>
                                          <td>
                                            <input type="text" width="170px" readonly="true" style="background-color:transparent;border-color:#cccccc">
                                              <xsl:attribute name ="value">
                                                <xsl:value-of select ="@KjkmName"/>
                                              </xsl:attribute>
                                            </input>
                                          </td>
                                          <td align="right">
                                            <img style="cursor:hand" src="/_imgs/btn_off_lookup.gif" onclick="SelectKjkm(this)" >
                                              <xsl:choose>
                                                <xsl:when test ="$IsDisabled='True'">
                                                  <xsl:attribute name="style">filter:gray;</xsl:attribute>
                                                  <xsl:attribute name="disabled">true</xsl:attribute>
                                                </xsl:when>
                                              </xsl:choose>
                                            </img>
                                          </td>
                                        </tr>
                                   </table>
                                </td>
                                <!--辅助核算-->
                                <td class="tdClass">
                                  <input type="text" width="100%"  readonly="true" style="background-color:transparent;border-color:#cccccc">
                                    <xsl:attribute name ="value">
                                      <xsl:value-of select ="@HsxmObjectText"/>
                                    </xsl:attribute>
                                  </input>
                                </td>
                                <!--借方金额-->
                                <td class="tdClass">
                                  <table cellpadding="0" cellspacing="0" width="100%" style="TABLE-LAYOUT:fixed">
                                    <col></col>
                                    <col width="17" align="right"></col>
                                    <tr>
                                      <td>
                                        <input  type="text"  readonly="true" style="background-color:transparent;border-color:#cccccc" onchange="changeAmount('JfAmount',this)">
                                          <xsl:choose>
                                            <xsl:when test ="@YDDirection='借方'">
                                              <xsl:attribute name ="title">
                                                <xsl:value-of select ="@AmountFiledCN"/>
                                              </xsl:attribute>
                                              <xsl:attribute name ="value">
                                                <xsl:value-of select ="@AmountFiledCN"/>
                                              </xsl:attribute>
                                                  <xsl:attribute name ="AmountValue">
                                                <xsl:value-of select ="@AmountFiled"/>
                                              </xsl:attribute>
                                            </xsl:when>
                                            <xsl:otherwise>
                                              <xsl:attribute name ="title"></xsl:attribute>
                                              <xsl:attribute name ="value"></xsl:attribute>
                                              <xsl:attribute name ="AmountValue"></xsl:attribute>
                                            </xsl:otherwise>
                                          </xsl:choose>
                                        </input>
                                      </td>
                                      <td>
                                        <img style="cursor:hand" src="/_imgs/selectOff.gif" onclick="showItem(this)" >
                                          <xsl:choose>
                                            <xsl:when test ="$IsDisabled='True'">
                                              <xsl:attribute name="style">filter:gray;</xsl:attribute>
                                              <xsl:attribute name="disabled">true</xsl:attribute>
                                            </xsl:when>
                                          </xsl:choose>
                                        </img>
                                      </td>
                                    </tr>
                                  </table>
                                </td>
                                <!--贷方金额-->
                                <td class="tdClass">
                                  <table cellpadding="0" cellspacing="0" width="100%" style="TABLE-LAYOUT:fixed">
                                    <col></col>
                                    <col width="17" align="right"></col>
                                    <tr>
                                      <td>
                                        <input type="text" readonly="true" style="background-color:transparent;border-color:#cccccc" onchange="changeAmount('DfAmount',this)">
                                          <xsl:choose>
                                            <xsl:when test ="@YDDirection='贷方'">
                                              <xsl:attribute name ="title">
                                                <xsl:value-of select ="@AmountFiledCN"/>
                                              </xsl:attribute>
                                              <xsl:attribute name ="value">
                                                <xsl:value-of select ="@AmountFiledCN"/>
                                              </xsl:attribute>
                                              <xsl:attribute name ="AmountValue">
                                                <xsl:value-of select ="@AmountFiled"/>
                                              </xsl:attribute>
                                            </xsl:when>
                                            <xsl:otherwise>
                                              <xsl:attribute name ="title"></xsl:attribute>
                                              <xsl:attribute name ="value"></xsl:attribute>
                                              <xsl:attribute name ="AmountValue"></xsl:attribute>
                                            </xsl:otherwise>
                                          </xsl:choose>
                                        </input>
                                      </td>
                                      <td>
                                        <img style="cursor:hand" src="/_imgs/selectOff.gif" onclick="showItem(this)" >
                                          <xsl:choose>
                                            <xsl:when test ="$IsDisabled='True'">
                                              <xsl:attribute name="style">filter:gray;</xsl:attribute>
                                              <xsl:attribute name="disabled">true</xsl:attribute>
                                            </xsl:when>
                                          </xsl:choose>
                                        </img>
                                      </td>
                                    </tr>
                                  </table>
                                </td>
                                <!--金额规则-->
                                <td class="tdClass">
                                  <xsl:attribute name ="style">
                                    <xsl:choose>
                                      <xsl:when test ="$Application='0101'">display:inline</xsl:when>
                                      <xsl:otherwise>display:none</xsl:otherwise>
                                    </xsl:choose>
                                  </xsl:attribute>
                                  <select name="AmountRule" style="WIDTH:100%;" onchange="changeInversion(this)">
                                    <xsl:choose>
                                      <xsl:when test ="$IsDisabled='True'">
                                        <xsl:attribute name="disabled">true</xsl:attribute>
                                      </xsl:when>
                                    </xsl:choose>
                                    <option value="1" >
                                      <xsl:choose>
                                      <xsl:when test ="@IsInversion='1'"><xsl:attribute name ="selected">selected</xsl:attribute></xsl:when>
                                      </xsl:choose>
                                      X 1</option>
                                    <option value="-1" >
                                      <xsl:choose>
                                        <xsl:when test ="@IsInversion='-1'">
                                          <xsl:attribute name ="selected">selected</xsl:attribute>
                                        </xsl:when>
                                      </xsl:choose>X -1</option>
                                  </select>
                                </td>
                                <!--删除按钮-->
                                <td class="tdClass" align="center">
                                  <xsl:attribute name ="style">
                                    <xsl:choose>
                                      <xsl:when test ="@IsAddEntry = '1' and $IsDisabled='False'">display:inline</xsl:when>
                                      <xsl:otherwise>display:none</xsl:otherwise>
                                    </xsl:choose>
                                  </xsl:attribute>
                                  <img src="/images/Delete_16_blue.gif" onclick="DeleteEntry(this)" style="cursor:hand;" ></img>
                                </td>
                              </tr>
                            </xsl:for-each>                        
                          </table>
                        </td>
                        <td></td>
                      </tr>                  
                    </table>
                  </xsl:for-each>
                </td>
              </tr>
            <tr>
            <td></td>
          </tr>
          </xsl:for-each>
        </table>
        </td>
      </tr>
    </table>
  </xsl:template>

</xsl:stylesheet>
